#ifndef GAMEENGINE_GAMEPLAY_OBJECTS_OBJECT_H
#define GAMEENGINE_GAMEPLAY_OBJECTS_OBJECT_H

#include <GameEngine/Gameplay/gameplay_settings.h>

#include <GameEngine/Gameplay/Objects/object_world.h>
#include <GameEngine/Gameplay/Statistics/statistics_manager.h>
#include <GameEngine/Core/Classes/rtti.h>


#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

//=================================================================================


//! An object that can have some statistics on it and that have an associated state
/*!
 *  An object has a state and some statistics associated to him, which can for
 *  example be the life of the object before it falls incapacitated / dead.
 *
 *  The state of the object can be queried using the state() function, and changed
 *  using the set_state() function. The statistics of the object are handled by a
 *  statistic manager, which can be accessed using the stats() function. Please
 *  refer to the StatisticsManager documentation to see how statistics can be
 *  manipulated by client code.
 */
class _Gameplay_decl Object : public ObjectWorld {
	GAMEENGINE_DECLARE_RTTI_PARENT(Object,ObjectWorld)
	Q_OBJECT

public:
	//! Current state of the object
	/*!
	 *  This state is solely a descriptor. The effects of the state on the
	 *  objects are dependent on the object type
	 *
	 @note All states may not be acceptable on all types of objects
	 */
	enum State {
		//! Object is in its normal, default state
		Normal,
		//! Object is sleeping (typically describes an actor state)
		Sleeping,
		//! Object is incapacitated and cannot perform some of its normal functions
		Incapacitated,
		//! Object is dead or broken and cannot perform most of its normal functions
		Dead
	};

	Object();
	Object(const Object& rhs);
	Object& operator=(const Object& rhs);
	virtual ~Object();

	const StatisticsManager& stats() const;
	StatisticsManager& stats();

	State state() const;
	virtual void set_state(State state);

signals:
	//! Signal emitted when the state of the object changes
	/*!
	 @param state The new state of the object
	 */
	void state_changed(State state) const;

protected:
	//! The set of statistics associated to the object
	StatisticsManager stats_;

	//! The state of the object
	State state_;
};

//========================================================

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
